import { ICompatibleAdapter, AdapterInfo, ProtocolType } from '../core/interfaces';

export class NodeV16Adapter implements ICompatibleAdapter {
    getInfo(): AdapterInfo {
        return {
            name: 'NodeV16Adapter',
            version: '1.0.0',
            target: 'node16',
            protocol: ProtocolType.HTTP // 默认支持HTTP
        };
    }

    isSupported(): boolean {
        // 模拟Node.js 16.x环境检测
        return process.version.startsWith('v16.');
    }

    supportsProtocol(protocol: ProtocolType): boolean {
        return protocol === ProtocolType.HTTP || 
               protocol === ProtocolType.HTTPS;
    }

    async execute<T>(input: T): Promise<T> {
        // 模拟Node.js 16.x特有处理逻辑
        console.log('Processing with Node.js 16.x compatibility layer');
        return input;
    }

    async resolve(hostname: string): Promise<string> {
        // 模拟DNS解析
        return `127.0.0.1 (resolved by NodeV16Adapter)`;
    }
}